<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head lang="zh-CN">
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <meta http-equiv="Access-Control-Allow-Origin" content="localhost:8080"/>
    <title>用戶组新增</title>
</head>
 <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" rel="stylesheet"/>
 <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
 <link href="/lib/layer/theme/default/layer.css" rel="stylesheet"/>
 
 <script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js"></script>
 <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
 <script src="/lib/layer/layer.js"></script>
 <script src="/js/common.js"></script>
<body>
<div class="container">
	<form action="" method="post">
		<div class="form-group">
    		<label for="name">用户组名称</label>
    		<input type="text" class="form-control" id="name" placeholder="your groups name write here"/>
  		</div>
  		<div class="form-group">
    		<label for="type">用户组类型</label>
    		<input type="text" class="form-control" id="type" placeholder="your group type write here"/>
  		</div>
	</form>
	<button class="btn btn-default" id="save" type="submit" onclick="addForm()">提交</button>
</div>
<script type="text/javascript">
	function addForm(){
		$.ajax({
            url:"/groups/groupAdd",
            type:"post",
            data:{
            	name:$("#name").val(),
            	type:$("#type").val(),
            },
            success:function(result){
                if(result.status==0)
                	layer.msg("用户组创建成功");
                else
                	layer.msg("创建失败");
            },
            error:function(e){
                alert("错误！！");
                window.clearInterval(timer);
            }
        });        
	}
</script>
</body>
</html>